//
//  RHTagCell.m
//  RuiHeAppApp
//
//  Created by Yan Chen on 2023/11/20.
//

#import "RHTagCell.h"
@interface RHTagCell()




@end
@implementation RHTagCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]){
        [self setupUI];
    }
    return self;
}

-(void)setupUI
{
    kWeakSelf;
    UIView *bgView = kView;
    bgView.backgroundColor = kCOLOR_HEX(@"#F3F7FF");
    bgView.layer.cornerRadius = 8;
    bgView.layer.masksToBounds = YES;
    [self.contentView addSubview:bgView];
    
    UIImageView *bgImg = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"network_tag_cellBg"]];
    bgImg.contentMode = UIViewContentModeScaleToFill;
    [bgView addSubview:bgImg];
    [bgImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.insets(UIEdgeInsetsZero);
    }];
    
    _titleLab = [[QMUILabel alloc]init];
    _titleLab.textColor = [UIColor colorWithHexString:@"#171A1D" alpha:0.8];
    _titleLab.font = [UIFont systemFontOfSize:16];
    _titleLab.numberOfLines = 2;
    [bgView addSubview:_titleLab];
    
    _icon = [[UIImageView alloc]init];
    [bgView addSubview:_icon];
    
    _tagImg = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"ugrade_select"]];
    [bgView addSubview:_tagImg];
    
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.insets(UIEdgeInsetsMake(5, 15, 5, 10));
    }];
    
    [_icon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.offset(30);
        make.left.mas_offset(15);
        make.centerY.mas_offset(-3);
    }];
    
    [_tagImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.offset(25);
        make.right.mas_offset(-15);
        make.centerY.mas_offset(-3);
    }];
    
    [_titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_offset(-3);
        make.left.equalTo(weakSelf.icon.mas_right).offset(5);
        make.right.equalTo(weakSelf.tagImg.mas_left).offset(-5);
    }];
}


@end
